package shuati.tengxun;

import java.util.Scanner;

/**
 * @author : LdLtd
 * @Date : 2023/11/16
 * @Description:云智大数据开发
 * 判断回文数
 */
public class yunzhishu2 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        for (int i = 1; i <=n; i++) {
            if(find(i)) System.out.println(i);
        }
    }
    public  static boolean find(int k){
        if(k<0||(k%10==0&&k!=0)){
            return false;
        }
        int tem=0;
        while (k>tem){
            tem=tem*10+k%10;
            k/=10;
        }
        return k==tem||k==tem/10;
    }
}
